package httptoken

import (
	"time"
)

func (token *Token) clean() {
	for {
		time.Sleep(time.Hour)
		now := time.Now().Unix()
		before := token.expTime
		if token.expTime > 0 {
			before = 86400
		}
		token.lock.Lock()
		for k, v := range token.dropList {
			if v+before > now {
				continue
			}
			delete(token.dropList, k)
		}
		token.lock.Unlock()

	}

}
